package cn.itcast.zt;

import cn.itcast.zt.domain.Department;
import cn.itcast.zt.extend.SpringContextUtil;
import cn.itcast.zt.extend._1ApplicationContextInitializer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class SpringbootLearningApplication {

    public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(SpringbootLearningApplication.class) ;
        springApplication.addInitializers(new _1ApplicationContextInitializer());
        ApplicationContext applicationContext = springApplication.run(args);

        System.out.println("FactoryBean测试1: "+applicationContext.getBean("department"));
        System.out.println("FactoryBean测试2: "+applicationContext.getBean(Department.class));

        System.out.println(SpringContextUtil.getBean(Department.class));
    }
}
